package com.example.pattern.observer.demo01;

import java.util.Observable;
import java.util.Observer;

public class Teacher implements Observer {

    private String name;

    public Teacher(String name) {
        this.name = name;
    }

    @Override
    public void update(Observable o, Object arg) {
        GPer gper = (GPer) o;
        Question question = (Question) arg;
        System.out.println("======================");
        System.out.println(this.name + "老师您好");
        System.out.println(("您收到了一个来自 " + gper.getName() + " 的提问，内容如下："));
        System.out.println(question.getContent());
        System.out.println("提问者：" + question.getUsername());
    }
}
